<div id="product-detail-modal" class="modal fade">
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">商品编辑</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <br>
                    <form id="product-detail-form" action='{:U("Admin/Product/updateProduct")}' method="post">
                    <div class="form-group">
                        <div class="col-sm-12">
                            <div class="col-sm-1"></div>
                            <div class="col-sm-3" style="padding-top:5px">
                                <label for="name" class="control-label">商品名称：</label>
                            </div>
                            <div class="col-sm-6">
                                <input id="product_id" name="product_id" class="form-control" style="display:none;"></input>
                                <input id="name" name="name" class="form-control"></input>
                            </div>
                        </div>
                        <div class="col-sm-12">
                            <br>
                            <div class="col-sm-1"></div>
                            <div class="col-sm-3" style="padding-top:5px">
                                <label for="subname" class="control-label">商品副标题：</label>
                            </div>
                            <div class="col-sm-6">
                                <input id="subname" name="subname" class="form-control"></input>
                            </div>
                        </div>

                        <div class="col-sm-12">
                            <br>
                            <div class="col-sm-1"></div>
                            <div class="col-sm-3" style="padding-top:5px">
                                <label for="kj_price" class="control-label">快驹售价：</label>
                            </div>
                            <div class="col-sm-6">
                                <input id="kj_price" name="kj_price" class="form-control"></input>
                            </div>
                        </div>

                        <div class="col-sm-12">
                            <br>
                            <div class="col-sm-1"></div>
                            <div class="col-sm-3" style="padding-top:5px">
                                <label for="remain_amount" class="control-label">库存量：</label>
                            </div>
                            <div class="col-sm-6">
                                <input id="default_amount" name="default_amount" class="form-control"></input>
                            </div>
                        </div>

                        <div class="col-sm-12">
                            <br>
                            <div class="col-sm-1"></div>
                            <div class="col-sm-3" style="padding-top:5px">
                                <label for="origin_amount" class="control-label">原始库存量：</label>
                            </div>
                            <div class="col-sm-6">
                                <input id="origin_amount" name="origin_amount" class="form-control"></input>
                            </div>
                        </div>

                        <div class="col-sm-12">
                            <br>
                            <div class="col-sm-1"></div>
                            <div class="col-sm-3" style="padding-top:5px">
                                <label for="warning_amount" class="control-label">库存警告量：</label>
                            </div>
                            <div class="col-sm-6">
                                <input id="warning_amount" name="warning_amount" class="form-control"></input>
                            </div>
                        </div>

                        <div class="col-sm-12">
                            <br>
                            <div class="col-sm-1"></div>
                            <div class="col-sm-3" style="padding-top:5px">
                                <label for="index" class="control-label">排序：</label>
                            </div>
                            <div class="col-sm-6">
                                <input id="index" name="index" class="form-control"></input>
                            </div>
                        </div>

                        <br><br>
                    </div>
                    </form>
                </div>
            </div>
            <if condition="$Think.session.admin.type neq '0'">
            <div class="modal-footer">
                <button class="btn btn-primary" onclick="saveProduct()">保存</button>
                <button class="btn btn-defalt" data-dismiss="modal">取消</button>
            </div>
            <else />
            </if>
        </div>
    </div>
</div>

<div id="product-detail-note" class="modal fade">
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">补足库存备注</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                <form id="product-note-form" action='{:U("Admin/Product/addAdminRepository")}' method="post">
                <div class="form-group">
                    <div class="col-sm-12">
                        <br>

                        <div class="col-sm-2" style="padding-left:15px;padding-top:5px">
                            <label for="note" class="control-label">备注：</label>
                        </div>
                        <div class="col-sm-9">
                            <textarea id="note" name="note" class="form-control" style="height:100px"></textarea>
                        </div>
                    </div>
                    <br><br>
                </div>
                </form>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-primary" onclick="saveNote()">确认</button>
                <button class="btn btn-defalt" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<script>
function saveProduct(){
    $('#product-detail-form').ajaxSubmit({      
        success:function(data){
            //console.log(data);
            $('#product-detail').modal('hide');
            location.reload();
        }
    });
}

function saveNote(){
    $('#product-note-form').ajaxSubmit({    
        data:{
            a_repository_id : a_repository_id,
            b_repository_id : b_repository_id
        },
        success:function(data){
            $('#product-detail-note').modal('hide');
            location.reload();
        }
    });
}
</script>